package cn.sxt.common.shop.util;

import java.io.InputStream;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class ConstantFinalUtil {
	/* 打印日志 */
	public static final Logger LOGGER = LogManager.getLogger();
	/* 所有的字符串 */
	public static final String ALLSTR = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	/* 获取配置文件常量 */
	public static JSONObject CONFIG_JSON = new JSONObject();
	/* 初始化就加载的配置文件 */
	static{
		/**
		 * 读取json的配置文件
		 */
		String jsonStr = "";
		try {
			InputStream is = ConstantFinalUtil.class.getClassLoader().getResourceAsStream("config.json");
			FileUtil fileUtil = new FileUtil();
			jsonStr = fileUtil.readFile(is);
			JSONObject resultJson = (JSONObject) JSON.parse(jsonStr);
			CONFIG_JSON = (JSONObject) resultJson.get("config");
			ConstantFinalUtil.LOGGER.info("---------json配置文件初始化成功-内容："+resultJson);
		} catch (Exception e) {
			ConstantFinalUtil.LOGGER.info("---------json配置文件初始化失败：内容",jsonStr,e);
		}
	}
}
